main() {
  Student student = Student("张三", 18, 1.80, true, "清华大学");
  print(student.name);
  print(student.age);
  print(student.height);
  print(student.isStudent);
  print(student.school);
  student.study();

  StudentTeacher studentTeacher =
      StudentTeacher("李四", 20, 1.85, false, "清华大学", "张三");
  print(studentTeacher.name);
  print(studentTeacher.age);
  print(studentTeacher.height);
  print(studentTeacher.isStudent);
  print(studentTeacher.school);
  print(studentTeacher.teacher);
  studentTeacher.studyAndTeach();
  studentTeacher.study();
  studentTeacher.teach();
}

class Student extends Person {
  String? school;
  Student(super.name, super.age, super.height, super.isStudent, this.school);
  void study() {
    print("学生正在学习");
  }
}

class Person {
  String? name;
  int? age;
  double? height;
  bool? isStudent;
  Person(this.name, this.age, this.height, this.isStudent);
}

//定义一个学生-老师类
class StudentTeacher extends Student {
  String? teacher;
  StudentTeacher(super.name, super.age, super.height, super.isStudent,
      super.school, this.teacher);
  void teach() {
    print("老师正在教学");
  }

  // 重写父类的方法，关键字可以省略，但是为了代码的可读性，最好还是写上·
  @override
  void study() {
    print("老师正在学习");
  }

  void studyAndTeach() {
    study();
    teach();
  }
}
